package com.smforj.ssm.modules.lib.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smforj.ssm.frame.core.dao.BaseDao;
import com.smforj.ssm.frame.core.service.impl.BaseServiceImpl;
import com.smforj.ssm.modules.lib.dao.SysBookinfoDao;
import com.smforj.ssm.modules.lib.domain.SysBook;
import com.smforj.ssm.modules.lib.domain.vo.SysBookVo;
import com.smforj.ssm.modules.lib.service.BookInfoService;

/*****
 * 
 * 
 * @author Haijun Gao 
 * @date 2017-11-17 下午2:21:42
 * @desp http://www.cnblogs.com/saga5998/
 * @email 573107773@qq.com
 */
@Service("sysBookInfoService")
//@JDataSource("")
public class BookInfoServiceImpl extends BaseServiceImpl<SysBook> implements BookInfoService {

	@Autowired
	private SysBookinfoDao sysBookinfoDao;
	
	@Override
	protected BaseDao<SysBook> getBaseDao() {
		return sysBookinfoDao;
	}

	@Override
	public SysBookVo selectBookByRfid(String rfid) { 
		return sysBookinfoDao.selectBookByRfid(rfid);
	}

	@Override
	public SysBookVo queryBook(String rfid, String barcode) { 
		SysBookVo sb = sysBookinfoDao.selectBookByRfid(rfid);
		if(sb == null)
		{
			SysBook query = new SysBook();
			query.setBarcode(barcode);
			sb = sysBookinfoDao.selectOne(query );
		}
		return sb;
	}

}
